package com.xiaodou.mjf.infrastructure.common.app;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.xiaodou.mjf.infrastructure.common.components.Result;
import com.xiaodou.mjf.infrastructure.common.utils.StringUtils;

/**
 * Created by yunjun.xu on 2015-02-06
 */
public abstract class CommonManager {

    protected Logger logger = LoggerFactory.getLogger(getClass());

    public Result result(Boolean isSuccessful,String message){
        Result result = new Result();
        result.setSuccess(isSuccessful);
        result.setMessage(message);
        return result;
    }

    public Result result(boolean isSuccessful){
        return result(isSuccessful, StringUtils.EMPTY);
    }

    public Result success(){
        return result(true);
    }

    public Result failure(){
        return result(false);
    }

    public Result failure(String message){
        return result(false,message);
    }

}
